<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .div1 {
            width: 200px;
            height: 200px;
            background-color: #e15761;
        }
        .div2 {
            width: 100px;
            height: 100px;
            background-color: #f5dc3a;
            border-radius: 50%;
        }
    </style>
</head>
<body>
    <p>鼠标事件：如果绑定事件的dom元素存在子元素,如div嵌套
        mouseover / mouseout 在进入子元素时，会在次触发事件。
        其实就是冒泡mouseenter/mouseleave在进入子元素时，不会再次触发事件，只是会触发自己的事件</p>
    <div class="div1">
        <div class="div2"></div>
    </div>
    <script>
        var div = document.querySelector('.div1');
        div.addEventListener('click', function() {
            console.log('click');
        })
        // 双击
        div.addEventListener('dblclick', function() {
            console.log('老铁双击666');
        })
        // 右键
        div.addEventListener('contextmenu', function() {
            console.log('你币有了');
        })
        div.addEventListener('mouseover', function() {
            console.log('出现UFO！');
        })
        div.addEventListener('mouseout', function() {
            console.log('驱逐出境！');
        })
        div.addEventListener('mousemove', function() {
            console.log('四处奔波');
        })
        // 鼠标某个减按下
        div.addEventListener('mousedown', function() {
            console.log('人在屋檐下');
        })
        // 鼠标某个减弹起
        div.addEventListener('mouseup', function() {
            console.log('莫挨劳资');
        })
        div.addEventListener('mouseenter', function() {
            console.log('我不会在子元素中触发');
        })
        div.addEventListener('mouseleave', function() {
            console.log('俺也一样');
        })
    </script>
</body>
</html>